namespace Jumpton.SFA.Server.Entity {
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Jumpton.Persistent;
    using System.Data;
    
    
    [Map("PRODUCT_SHIP_FROM")]
    public class PRODUCT_SHIP_FROM : ObjectRow {
        
        public PRODUCT_SHIP_FROM() {
        }
        
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">DataTable 中的一行数据</param>
        /// <param name="objectTable">存储当前对象的数据表格</param>
        public PRODUCT_SHIP_FROM(System.Data.DataRow dataRow, ObjectTable parent) : 
                base(dataRow, parent) {
        }

        [Key("ID", true, true)]//主键,对应数据库中的列名
        public int ID
        {
            get { return (int)GetValue("ID"); }
            set { SetValue("ID", value); }
        }
        
        [Field("PRODUCT_ID")]
        public decimal ProductID
        {
            get {
                return (System.Decimal)GetValue("ProductID");
            }
            set {
                SetValue("ProductID", value);
            }
        }

        [CalculateField]
        public string ProductName
        {
            get
            {
                PRODUCTS product = (PRODUCTS)ObjectRow.Load(typeof(PRODUCTS),
                    string.Format(" this.ProductCode='{0}'", this.ProductID));
                if (product != null)
                    return product.ProductName;
                return "";
            }
        }
        
        [Field("SHIP_FROM_CODE")]
        public string SHIPFROMCODE {
            get {
                return (System.String)GetValue("SHIPFROMCODE");
            }
            set {
                SetValue("SHIPFROMCODE", value);
            }
        }
        
        [Field("PIECE_PRICE")]
        public decimal PIECEPRICE {
            get {
                return (System.Decimal)GetValue("PIECEPRICE");
            }
            set {
                SetValue("PIECEPRICE", value);
            }
        }
        
        [Field("DISPLAY_SEQUENCE")]
        public decimal DISPLAYSEQUENCE {
            get {
                return (System.Decimal)GetValue("DISPLAYSEQUENCE");
            }
            set {
                SetValue("DISPLAYSEQUENCE", value);
            }
        }
        
        [Field("ON_HOLD")]
        public string ONHOLD {
            get {
                return (System.String)GetValue("ONHOLD");
            }
            set {
                SetValue("ONHOLD", value);
            }
        }

        [Field("LAST_UPDATER")]
        public string LAST_UPDATER
        {
            get
            {
                return (System.String)GetValue("LAST_UPDATER");
            }
            set
            {
                SetValue("LAST_UPDATER", value);
            }
        }

        [Field("LAST_UPDATE_TIME")]
        public decimal LAST_UPDATE_TIME
        {
            get
            {
                return (decimal)GetValue("LAST_UPDATE_TIME", DateTime.Now);
            }
            set
            {
                SetValue("LAST_UPDATE_TIME", value);
            }
        }

        [Field("CREATE_TIME")]
        public long CREATETIME
        {
            get
            {
                return (long)GetValue("CREATETIME", DateTime.Now);
            }
            set
            {
                SetValue("CREATETIME", value);
            }
        }

        [Field("ACTIVE")]
        public Boolean ACTIVE
        {
            get
            {
                return (System.Boolean)GetValue("ACTIVE", false);
            }
            set
            {
                SetValue("ACTIVE", value);
            }
        }
        [Field("MOQ")]
        public decimal MOQ {
            get {
                return (System.Decimal)GetValue("MOQ");
            }
            set {
                SetValue("MOQ", value);
            }
        }
        
        [Field("UOM_CODE")]
        public string UOMCODE {
            get {
                return (System.String)GetValue("UOMCODE");
            }
            set {
                SetValue("UOMCODE", value);
            }
        }
        
        [Field("WEIGHT")]
        public decimal WEIGHT {
            get {
                return (System.Decimal)GetValue("WEIGHT");
            }
            set {
                SetValue("WEIGHT", value);
            }
        }
        
        [Field("VOLUME")]
        public decimal VOLUME {
            get {
                return (System.Decimal)GetValue("VOLUME");
            }
            set {
                SetValue("VOLUME", value);
            }
        }
        
        [Field("INTERNAL_PR_CODE")]
        public string INTERNALPRCODE {
            get {
                return (System.String)GetValue("INTERNALPRCODE");
            }
            set {
                SetValue("INTERNALPRCODE", value);
            }
        }
        
        [Field("CASE_PRICE")]
        public decimal CASEPRICE {
            get {
                return (System.Decimal)GetValue("CASEPRICE");
            }
            set {
                SetValue("CASEPRICE", value);
            }
        }
        
        [Field("INVENTORY")]
        public decimal INVENTORY {
            get {
                return (System.Decimal)GetValue("INVENTORY");
            }
            set {
                SetValue("INVENTORY", value);
            }
        }
        
        [Field("BUNDLE_FLAG")]
        public string BUNDLEFLAG {
            get {
                return (System.String)GetValue("BUNDLEFLAG");
            }
            set {
                SetValue("BUNDLEFLAG", value);
            }
        }
        
        [Field("DOMAIN_ID")]
        public decimal DOMAINID {
            get {
                return (System.Decimal)GetValue("DOMAINID");
            }
            set {
                SetValue("DOMAINID", value);
            }
        }

       

        [CalculateField]
        public bool OnHold
        {
            get
            {
                return (System.String)GetValue("ONHOLD") == "1" ? true : false;
            }
        }
    }
}
